import Vue from 'vue'

export default {
  create(data) {
    console.log(JSON.stringify(data));
    
    return new Promise((resolve, reject) => {
      Vue.axios.post('/supervision/project', data).then(response => {
        resolve(response.data)
      })
    })
  },
  
  getList(map = {}) {
    return new Promise((resolve, reject) => {
      Vue.axios.get('/supervision/project', {params: map}).then(response => {
        resolve(response.data)
      })
    })
  },
  
  getInfo(id, map = {}) {
    return new Promise((resolve, reject) => {
      Vue.axios.get('/supervision/project/' + id, {params: map}).then(response => {
        resolve(response.data)
      })
    })
  },
  
  update(id, data) {
    console.log(JSON.stringify(data));
    return new Promise((resolve, reject) => {
      Vue.axios.put('/supervision/project/' + id, data).then(response => {
        resolve(response.data)
      })
    })
  },
  
  delete(id) {
    return new Promise((resolve, reject) => {
      Vue.axios.delete('/supervision/project/' + id).then(response => {
        resolve(response.data)
      })
    })
  }
}
